package daobeauty.test.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.hibernate.Criteria;
import org.hibernate.Query;

import daobeauty.dao.Limiting;
import daobeauty.dao.Sorting;
import daobeauty.test.domain.D1;

/**
 * Created 12.09.2008
 * @author M. Serhat Cinar
 *
 */
public interface D1Dao{
	public Class getDomain();
	public Class<? extends Serializable> getPrimaryKey();
	
	// PK
	public D1 findById(Long id);
	public D1 findByPrimaryKey(Long id);

	// CRUD
	public void saveOrUpdate(D1 d1);
	public void save(D1 d1);
	public void delete(D1 d1);
	public void update(D1 d1);

	// helpers
	public Query getNamedQuery(String query);
	public Criteria createCriteria();

	public List<D1> findByExample(D1 example);
	public List<D1> findByExample(D1 example, Sorting sorting);
	public List<D1> findByExample(D1 example, Sorting sorting, Limiting limit);
	public List<D1> findByExample(D1 example, Limiting limit);
	
	public List<D1> findAll();
	public List<D1> findAll(String hql, Object[] parameters);
	public List<D1> findAll(String hql, Collection parameters);
	public List<D1> findAll(String hql, Map<String, Object> namedParameters);
	
	public List<D1> myNamedQuery();
	public D1 findByHighestId();
	

	public List<D1> findByNameAndSubject(String name, String subject);
	public List<D1> findByNameILikeAndSubjectIsNull(String name);
	public List<D1> findByFirstAndLastName(String name);
	public List<D1> findByNameAndSubject(String name, String subject, Sorting sorting, Limiting limiting);
	public List<D1> findByNameIsNotNull(Sorting sorting, Limiting limiting);
	public Object[] findBySubjectIsNotNull();
	
	public List findByNativeQuery(String sql);
	public List findByNativeQuery(String sql, Object[] parameters);
	public List findByNativeQuery(String sql, Map<String, Object> parameters);
}
